#ifndef MAINSCENE_H
#define MAINSCENE_H
#include<QTimer>
#include <QWidget>
#include"map.h"
#include "myplane.h"
#include"bullet.h"
#include "enemyplane1.h"
#include "enemyplane2.h"
#include "bomb.h"
#include"bomb1.h"
#include"config.h"
#include <QSoundEffect>
#include "bullet2.h"
#include <QPushButton>
#include <QPixmap> // 添加QPixmap头文件
#include <QKeyEvent>
#include <QLabel>
#include <QApplication>
#include "bomb2.h"
class Widget : public QWidget
{


public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void initscene();
    //启动游戏
    void playgame();
    //更新所有坐标
    void updateposition();
    //绘制屏幕
    void paintEvent(QPaintEvent*);
    //地图对象重要
    Map m_map;
    //飞机对象
    myplane m_hero;
    Q_OBJECT //
    //定时器
    QTimer m_Timer;
    void mouseMoveEvent(QMouseEvent*);
    //子弹对象(ceshi)
    //bullet temp_bullet;
    //敌机出场？1
    void enemyToscene();
    //敌机1数组
    ENemyplane m_enemys[ENEMY1_NUM];
    //敌机1出场间隔
    int m_recorder;
    // 敌机出场？2
    void enemyToscene2(); // 声明敌机2出场函数
    // 敌机2数组
    Enemyplane2 m_enemys2[ENEMY2_NUM];
    // 敌机2出场间隔
    int m_recorder2;
    //碰撞检测
    void collosionDEtection();
    //碰撞检测2
    void collosionDEtection2();
    //爆炸检测3
      void collosionDEtection3();
    //爆炸数组1
     bomb m_enemy1_bombs[BOMB_ENEMY1_NUM];
    //爆炸数组1
    bomb1 m_enemy2_bombs[BOMB_ENEMY2_NUM];
     //爆炸数组2
    bomb2 m_meBombs[BOMB_ME_NUM];
    //音效添加
    QSoundEffect m_backgroundSound;
    void updateEnemy2Bullets();
    //按键暂停
    QPushButton *m_pauseBtn;
    bool m_isPaused;
    void initPauseButton();
    ////////
     int m_enemy1_destroyedCount;
    int m_enemy2_destroyedCount;
     //按esc键结束游戏以及重新开始
     void keyPressEvent(QKeyEvent *event);
    void showGameOverScreen();
     void restartGame();
    QLabel *m_gameOverBackground;
    QPushButton *m_btnGameOver;
    QPushButton *m_btnAgain;
    QLabel *m_gameOverStats;
    //血条
    int m_heroHP;
    //初始背景
    QPushButton *m_startBtn;
    bool m_gameStarted;
#endif // MAINSCENE_H
};
